<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../css/tc/tc.css"/>
    <script src="../../js/getParameter.js"></script>
    <script src="../../js/jquery3.js"></script>
    <script src="../../layui/layui.js"></script>
    <style type="text/css">
        body {
            overflow-y: hidden;
        }
    </style>
</head>
<body>
<script>
    $(function () {
        layui.use('layer', function () {
            var layer = layui.layer;
            $.post("/product/findName", {}, function (res) {
                var htm = "";
                for (let i = 0; i < res.length; i++) {
                    htm += "<option value='" + res[i].prId + "'>" + res[i].prName + "</option>"
                }
                $("#prName").html(htm)


                let uid = getParameter("uid");
                $(".form").submit(function () {

                    $.ajaxSettings.async = false;
                    $.post("/order/addOrder?uId=" + uid, $(this).serialize(), function (data) {
                        if (data == "success") {
                            layer.msg('添加成功',{icon:6,time:1000}, function(){
                                window.parent.location.reload(); //刷新父页面
                                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                                parent.layer.close(index);
                            });
                        }
                    })

                    return false;
                })
            })
        })
    })
</script>
<!--弹框-->
<div class="cd-popup">
    <div class="cd-popup-container">
        <p></p>
        <div class="cd-buttons" style="margin-left: 40px;margin-top: 40px;">
            <form class="form">
                <div class="bd1">
                    <div><span>产品名称：</span><br>
                        <select id="prName" name="product.prId" class="from" >


                        </select></div>
                    <div><span>数量：</span><br><input type="text" name="orNum" id="orNum"/></div>

                </div>
                <div class="bd2">
                    <div><span>交货状态：</span><br>
                        <select id="orStatus" name="orStatus" class="from">
                            <option value="未交货">未交货</option>
                            <option value="已交货">已交货</option>
                        </select></div>
                    <div><span>收货单位：</span><br><input type="text" name="orTarget" id="orTarget"/></div>
                </div>

                    <input type="submit" value="提交" class="submit"/>
            </form>
        </div>
    </div>
</div>
</body>
</html>
